function __cs_CardSpaceObject_OnClick(CardSpaceToken, ClientID)
{
    if(__cs_AreCardsSupported())
    {
        try
        {
            dnn.setVar('CardSpaceToken', CardSpaceToken.value);
            dnn.callPostBack(ClientID + '_Login');
        }
        catch (err)
        {
            switch(err.number)
            {
                case -1073413869:
                    break;
                default:
                    alert(err.message);
            }
        }
    }
}

function __cs_AreCardsSupported()
{ 
  var IEVer = -1; 
  if (navigator.appName == 'Microsoft Internet Explorer') 
    if (new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})")
       .exec(navigator.userAgent) != null) 
      IEVer = parseFloat( RegExp.$1 ); 

  // Look for IE 7+. 
  if( IEVer >= 6 ) 
  { 
    var embed = document.createElement("object"); 
    embed.setAttribute("type", "application/x-informationcard"); 

    if(  ""+embed.issuerPolicy != "undefined" ) 
      return true; 
    return false;         
  }     
  // not IE (any version)
  if( IEVer < 0 && navigator.mimeTypes && navigator.mimeTypes.length) 
  { 
    // check to see if there is a mimeType handler. 
    x = navigator.mimeTypes['application/x-informationcard']; 
    if (x && x.enabledPlugin) 
      return true; 

    // check for the IdentitySelector event handler is there. 
    var event = document.createEvent("Events"); 
    event.initEvent("IdentitySelectorAvailable", true, true); 
    top.dispatchEvent(event); 

    if( top.IdentitySelectorAvailable == true) 
      return true; 
  } 
  return false; 
}
